package ids;

import java.util.HashSet;

import util.Traces;
import ns2.Node;

public abstract class Sensor {
	public float falsePositiveRate;
	public float truePositiveRate;
	public Traces intrusionTraces;
	public Traces normalTraces;
	public Node location;
	public HashSet<Integer> attackers;
	public HashSet<Integer> victims;
	public boolean cooperate;
	public float deploymentCost;
	public float monitoringCost;
	public float efficiency;
	public int id;

	public Sensor() {
		this.location = new Node(0);
		this.normalTraces = new Traces();
		this.intrusionTraces = new Traces();
		this.attackers = new HashSet<Integer>();
		this.victims = new HashSet<Integer>();
	}

	public static Sensor createSensor(SensorType type) {
		switch (type) {
		case PortSensor:
			return new PortSensor();
		case ProbeSensor:
			return new ProbeSensor();
		default:
			throw new RuntimeException("Invalid Sensor Type");
		}
	}

	public abstract void run();

	public abstract void reset();

	public abstract boolean alert();

	public abstract HashSet<Integer> getAttackersID();

	public abstract HashSet<Integer> getVictimsID();

	public abstract float getScore();

	public abstract int getNumAttacks();

	public abstract SensorType getSensorType();

	public Node getLocation() {
		return location;
	}

	public void setLocation(Node location) {
		this.location = location;
	}

	public float getDeploymentCost() {
		return deploymentCost;
	}

	public void setDeploymentCost(float deploymentCost) {
		this.deploymentCost = deploymentCost;
	}

	public float getMonitoringCost() {
		return monitoringCost;
	}

	public void setMonitoringCost(float monitoringCost) {
		this.monitoringCost = monitoringCost;
	}

	public float getEfficiency() {
		return efficiency;
	}

	public void setEfficiency(float efficiency) {
		this.efficiency = efficiency;
	}
}
